package Tester;

import GetOffEr.GetOffManually;
import GetOffEr.GetOffMode;
import GetOffEr.GetOffUnderAutoPilot;
import spaceCraft.Engine;
import spaceCraft.ProductInfo;

import org.junit.*;

import static org.junit.Assert.*;


public class GetOfferTest {

    private int velocity = 4000;
    private String manualGoodReport = "This garbage-can is still easy to handle!";
    private String manualBadReport = "This stuff doesn't work again!";
    private String autoGoodReport = "Auto-get off..This garbage-can is doing everything for you!";
    private String autoBadReport = "Engine is broken..Next time I should check it first..";

    @Test
    public void testManualGetOffWithWorkingEngine() {
        Engine turboEngine = new Engine(new ProductInfo("UAZ", "IZDELIE#1"), velocity);
        GetOffMode getMode = new GetOffManually();
        assertTrue(getMode.getOff(turboEngine).contains(manualGoodReport));
    }

    @Test
    public void testManualGetOffWithBrokenEngine() {
        Engine turboEngine = new Engine(new ProductInfo("UAZ", "BOBIK"), velocity);
        GetOffMode getMode = new GetOffManually();
        turboEngine.breakDevice();
        assertTrue(getMode.getOff(turboEngine).contains(manualBadReport));
    }

    @Test
    public void testAutoGetOffWithWorkingEngine() {
        Engine turboEngine = new Engine(new ProductInfo("LAZ", "IZDELIE#2"), velocity);
        GetOffMode getMode = new GetOffUnderAutoPilot();
        assertTrue(getMode.getOff(turboEngine).contains(autoGoodReport));
    }

    @Test
    public void testAutoGetOffWithBrokenEngine() {
        Engine turboEngine = new Engine(new ProductInfo("GAZ", "66"), velocity);
        GetOffMode getMode = new GetOffUnderAutoPilot();
        turboEngine.breakDevice();
        assertTrue(getMode.getOff(turboEngine).contains(autoBadReport));
    }
}